package net.lcqf.tcp.send.message;

import cn.hutool.core.util.RandomUtil;
import cn.hutool.json.JSONUtil;
import io.netty.channel.Channel;
import net.lcqf.tcp.response.SkillConfigResponse;
import net.lcqf.tcp.send.MessageBaseService;
import net.lcqf.tcp.send.MessageFactory;
import net.lcqf.tcp.send.RequestType;
import net.lcqf.tcp.utils.LocalCacheUtil;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import java.util.*;

/**
 * +----------------------------------------------------------------------
 * // | Talk To [ 聊来改善地区金融服务环境，助力企业发展 ]
 * // +----------------------------------------------------------------------
 * // | Copyright (c) 2021-2025 聊来 All rights reserved.
 * // +----------------------------------------------------------------------
 * // | Licensed ( <a href="http://www.apache.org/licenses/LICENSE-2.0">apache</a> )
 * // +----------------------------------------------------------------------
 * // | @Author: 聊来 <18970881148@qq.com>
 * // +----------------------------------------------------------------------
 * // | DateTime: 2025/4/1 16:48
 * // +----------------------------------------------------------------------
 */

@Service
public class Connected implements MessageBaseService {

    @Override
    @PostConstruct
    public void init() {
        MessageFactory.register(RequestType.CONNECTED, this);
    }

    @Override
    public Object sendMessage(Channel channel, String msg) {
        Map<String, Object> connected = new HashMap<>(8);
        connected.put("conv", LocalCacheUtil.ATOMIC.getAndIncrement());
        connected.put("random", 888);

//        List<SkillConfigResponse> skill = Arrays.asList(
//                new SkillConfigResponse()
//        );
//
//        connected.put("skillConfig", skill);
//        connected.put("buffConfig", null);

        return connected;
    }
}
